package cn.kgc.mushroommanager.controller;

import cn.kgc.mushroomcommon.api.DataBaseOperationRemoteService;
import cn.kgc.mushroomcommon.pojo.ResultEntity;
import cn.kgc.mushroomcommon.pojo.Shoppingcar;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/shoppingcar/manager")
public class ShoppingCarController {
    @Resource
    DataBaseOperationRemoteService dataBaseOperationRemoteService;

    @RequestMapping("/query/shoppingcar/list")
    public List<Shoppingcar> selectShoppingCarList(){
        return dataBaseOperationRemoteService.selectShoppingCarList();
    }

    @RequestMapping("/batch/remove")
    public Integer batchRemove(@RequestBody List<Integer> shoppingCarIdList) {
        return dataBaseOperationRemoteService.batchRemove(shoppingCarIdList);
    }

    @RequestMapping("/query/shoppingcar/list/by/id/list")
    public List<Shoppingcar> getShoppingCarListByIdList(@RequestBody List<Integer> shoppingCarIdList) {
        return dataBaseOperationRemoteService.getShoppingCarListByIdList(shoppingCarIdList);
    }

    @RequestMapping("/addShopCar")
    public ResultEntity<String> addShopCar(@RequestBody Shoppingcar shoppingcar) {
        return dataBaseOperationRemoteService.addShopCar(shoppingcar);
    }
}
